#include "../Basics/BasicStruct.cpp"

// 比首节点小的元素放前面,大的放后面

void ChangeSeqList(SeqList list) {
    if (list->length == 1) {
        return;
    }

    int data = list->element[0];
    int left = 0;
    int right = list->length -1 ;
    while(left < right) {
        while(left < right && list->element[right] > data){
            right--;
        }
        if (left < right) {
            list->element[left] = list->element[right];
            left++;
        }
        while(left < right && list->element[left] < data){
            left++;
        }
        if (left < right) {
            list->element[right] = list->element[left];
            right--;
        }
    }
    list->element[left] = data;
    return;
}


int main() {
    SeqList list = CreateSeqList(5);
    ChangeSeqList(list);
}
